package com.finance.system.test;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class ListNode {
    int val;
    ListNode next;
    public ListNode(int x) { val = x; }

    public static ListNode findLast(ListNode ls) {
        ListNode last = ls;
        while(ls.getNext() != null){
            last = ls.getNext();
            ls = ls.getNext();
        }
        return last;
    }
}
